package com.example.rbacmanage.service.app.impl;

import com.example.rbacmanage.entity.app.Classic;
import com.example.rbacmanage.mapper.app.ClassicMapper;
import com.example.rbacmanage.service.app.ClassicService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ClassicServiceImpl implements ClassicService {
    @Autowired
    private ClassicMapper classicMapper;
    @Override
    public void save(Classic classic) {
        classicMapper.insert(classic);
    }

    @Override
    public void remove(Long[] ids) {
        for (Long id : ids) {
            classicMapper.del(id);
        }
    }

    @Override
    public void update(Classic classic) {
        classicMapper.update(classic);
    }

    @Override
    public List<Classic> getAll(Classic classic) {
        return classicMapper.list(classic);
    }

    @Override
    public PageInfo<Classic> getPage(Classic classic) {
        return new PageInfo<>(getAll(classic));
    }

    @Override
    public Classic getById(Long id) {
        return classicMapper.queryOneById(id);
    }

    @Override
    public Integer getCount(Classic classic) {
        return classicMapper.count(classic);
    }
}
